local jianxiong = fk.CreateSkill {
  name = "emo__jianxiong",
  dynamic_desc = function (self, player, lang)
    local n = math.max(math.min(player:usedSkillTimes(self.name, Player.HistoryGame), 5), 1)
    return "emo__jianxiong_dyn:" .. n
  end,
}

Fk:loadTranslationTable{
  ["emo__jianxiong"] = "奸雄",
  [":emo__jianxiong"] = "当你受到伤害后，你可以摸X张牌，并获得造成伤害的牌（X为发动此技能次数，至多为5）。",
  [":emo__jianxiong_dyn"] = "当你受到伤害后，你可以摸{1}张牌，并获得造成伤害的牌（X为发动此技能次数，至多为5）。",

  ["$emo__jianxiong"] = "太公曾教我一言，宁许我负人，不许人负我！",
}

jianxiong:addEffect(fk.Damaged, {
  anim_type = "masochism",
  on_use = function(self, event, target, player, data)
    local room = player.room
    local n = math.max(math.min(player:usedSkillTimes(jianxiong.name, Player.HistoryGame), 5), 1)
    player:drawCards(n, jianxiong.name)
    if not player.dead and data.card then
      local cards = room:getSubcardsByRule(data.card, {Card.Processing})
      room:obtainCard(player, cards, true, fk.ReasonJustMove, player, jianxiong.name)
    end
  end,
})

return jianxiong
